
# ----------------------------------------------------------------------------------------------
# This function simulates the model and provides some moments to compare with the baseline model
# ----------------------------------------------------------------------------------------------

function Simulations_Wrapper(ce::CE_Economy_PInf, Initial_Type; T=500_000)


#-------------------------------------------------------------------------------
# RUN THE SIMULATION
#-------------------------------------------------------------------------------
N = 1
y_sim, type_sim, b_sim, π_sim, def_sim, def_pol, def_id, q_sim, SP_sim, SP_HR_sim, c_sim, tb_sim, b_sim_tmp, VF_sim =
simul_econ_PI(ce,T,N, T0=5_000, Initial_Type=Initial_Type);

#-------------------------------------------------------------------------------
#Compute Moments
#-------------------------------------------------------------------------------
T0       = 100_000
T1       = 200_000
type_sim = type_sim[T0:T1]
def_sim  = def_sim[T0:T1]
SP_sim   = SP_sim[T0:T1]
b_sim    = b_sim[T0:T1]
y_sim    = y_sim[T0:T1]
by       =  (b_sim./y_sim)

#MOMENTS CONDITIONAL ON THE TYPE
#----------------------------------------------------------------------------------------------------
        filter_P  = (def_sim.==0).*(type_sim.==1)
        SP_mean_P =  mean(SP_sim[filter_P]) * 100
        SP_std_P  =  std(SP_sim[filter_P])  * 100
        by_mean_P =  mean(by[filter_P])     * 100


# Store relevant moment to construct Table 9 [only for the C-type]
#-------------------------------------------------------------------------------
target_mms_Ctype   = [by_mean_P;      SP_mean_P;       SP_std_P]

return target_mms_Ctype
end
#-------------------------------------------------------------------------------
